﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Fantacid303.ProcessAffinityControl.Manager.ValueProviders;
using Fantacid303.ProcessAffinityControl.Manager.MainWindowViewModels;
using Fantacid303.ProcessAffinityControl.Common;

namespace Fantacid303.ProcessAffinityControl.Manager.UserControls
{
	/// <summary>
	/// Interaction logic for ConfigurationRuleEdit.xaml
	/// </summary>
	public partial class ConfigurationRuleEdit : UserControl
	{
		public ConfigurationRuleEdit()
		{
			InitializeComponent();
		}

		private void button1_Click(object sender, RoutedEventArgs e)
		{
			((ConfigurationRuleViewModel)this.DataContext).ProcessName = "*";
		}

		private void cboAffinity_SelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			if (this.cboAffinity.SelectedItem != null && this.grpCustomAffinityMask != null)
			{
				var type = (ProcessorAffinityType)this.cboAffinity.SelectedItem;
				this.grpCustomAffinityMask.Visibility = (type == ProcessorAffinityType.Custom) ? Visibility.Visible : System.Windows.Visibility.Collapsed;
			}
		}
	}
}
